package com.example.cricketscorer.client.presenter;

import java.util.List;

import com.example.cricketscorer.client.CricketScorerEventBus;
import com.example.cricketscorer.client.bean.BatsmanBean;
import com.example.cricketscorer.client.bean.PlayerBean;
import com.example.cricketscorer.client.view.ScoringActionsView;
import com.example.cricketscorer.client.widget.interfaces.IButton;
import com.example.cricketscorer.client.widget.interfaces.ITextBox;
import com.example.cricketscorer.client.widget.interfaces.IWidget;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;

@Presenter(view = ScoringActionsView.class)
public class ScoringActionsPresenter extends BasePresenter<ScoringActionsPresenter.IScoringActionsView, CricketScorerEventBus> {
		
	public interface IScoringActionsView extends IWidget {
		ITextBox getScore4BallText();
		IButton getZeroButton();
		IButton getOneButton();
		IButton getTwoButton();
		IButton getThreeButton();
		IButton getFourButton();
		IButton getSixButton();
		
		IButton getWideButton();
		IButton getNoBallButton();
		IButton getByeButton();
		IButton getLegByeButton();
		
		IButton getPlusButton();
		IButton getWicketButton();
		IButton getConfirmButton();
	}
	
	private int score4Ball;
	private String Score4BallText;
	
	public void onStart() {
		System.out.println("Inside ScoringActionsPresenter.onstart()");
		resetScore4Ball();
		eventBus.changeActionsWidget(view);
	}

	private void resetScore4Ball() {
		setScore4Ball(0);
		setScore4BallText("");
		view.getConfirmButton().setEnabled(false);
	}
	
	void setScore4Ball(int ballScore) {
		this.score4Ball = ballScore;
	}

	void setScore4BallText(String score4BallText) {
		this.Score4BallText = score4BallText;
		view.getScore4BallText().setValue(score4BallText);
	}
	
}
